﻿<hdkui:LayoutAwarePage
    x:Class="HDK.Demo.Pages.HDKHUBSnipped"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:HDK.Demo.Pages"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:hdkui="using:HDK.UI.Controls"
    mc:Ignorable="d">

    <hdkui:LayoutAwarePage.Resources>

        <!-- Collection of items displayed by this page -->
        <CollectionViewSource
            x:Name="itemsViewSource"
            Source="{Binding HubItems}"/>

        <DataTemplate x:Name="LiveTileContentTemplate">
            <Grid DoubleTapped="Grid_DoubleTapped_1">
                <Image Stretch="UniformToFill" Source="{Binding ImagePath}" HorizontalAlignment="Stretch"/>
                <Border Background="#99000000" VerticalAlignment="Bottom">
                    <StackPanel Margin="5">
                        <TextBlock Foreground="White" Text="{Binding Name}" FontWeight="Bold" />
                        <TextBlock Foreground="White" Text="{Binding Description}" TextWrapping="Wrap" MaxHeight="30" TextTrimming="WordEllipsis"  />
                    </StackPanel>
                </Border>
            </Grid>
        </DataTemplate>

        <DataTemplate x:Name="HubDataTemplate">
            <hdkui:LiveTile ItemTemplate="{StaticResource LiveTileContentTemplate}" ItemsSource="{Binding Source={StaticResource itemsViewSource}}" />
        </DataTemplate>
<!--
            <hdkui:LiveTile ItemTemplate="{StaticResource LiveTileContentTemplate}" ItemsSource="{Binding Source={StaticResource itemsViewSource}}" />
        
        -->

        <Style x:Key="LiveTileContainerStyle" TargetType="GridViewItem">
            <Setter Property="Padding" Value="0" />
            <Setter Property="Margin" Value="0" />
            <Setter Property="HorizontalContentAlignment" Value="Left" />
        </Style>

    </hdkui:LayoutAwarePage.Resources>

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">

        <hdkui:VariableSizedGridView x:Name="vgvHubMain" Background="Azure"
                                HorizontalContentAlignment="Stretch"
                                VerticalContentAlignment="Stretch"
                                ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
                                SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                                ItemTemplate="{StaticResource HubDataTemplate}"
                                ItemContainerStyle="{StaticResource LiveTileContainerStyle}"
                                 
                                     >
            <hdkui:VariableSizedGridView.ItemsPanel>
                <ItemsPanelTemplate>
                    <VariableSizedWrapGrid ItemWidth="90" ItemHeight="150" Orientation="Vertical" Margin="0" MaximumRowsOrColumns="3"  />
                </ItemsPanelTemplate>
            </hdkui:VariableSizedGridView.ItemsPanel>
        </hdkui:VariableSizedGridView>
        
        <!--ProgressRing Grid.Row="1" IsActive="{Binding InterestingPhotos.IsLoading}"/-->
    </Grid>
</hdkui:LayoutAwarePage>